<%@page import="java.sql.*" %>
<%@ page import="java.util.*"%>
<%@ page import="com.hline.kbcss.MyDriver"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>::KBCSS::</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="styles.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="mainbg">
<!-- header begins -->
<%String uname=(String)session.getAttribute("uname");
String userid=(String)session.getAttribute("userid");
//int uid=Integer.parseInt(userid);


%>

<div id="header">
	<div id="buttons">
		<div class="menu_width">
		<ul>
			   
			<li><a class="active">Welcome&nbsp;&nbsp;<%=uname%></a></li>

		
	
			
			
			<li><a href="logout.jsp" title="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Logout</a></li>
		</ul>
		</div>
	</div>
	<div id="logo">
		<a href="#">Knowledge Based Community Sharing System</a>
		<h5>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--Interaction With Industry</h5>
		
	</div>
<!-- header ends -->
<!-- content begins -->
<div id="main">
<div id="main_top"></div>
<div id="content_bg">
  <div id="content"></div>
  <div id="right"> </br>
    <h2>My Account</h2>
    <div class="categories">
      <ul>
        <li><a href="articles.jsp">Articles</a></li>        
        <li><a href="mat.jsp">Materials</a></li>
        <li><a href="res.jsp">Research papers</a></li>
        <li><a href="postma.jsp">Post Material/Research papers</a></li>
                <li><a href="postarticle.jsp">Post Articles</a></li>
        <li><a href="reports.jsp">Reports</a></li>
        <li><a href="cp.jsp">Change Password</a></li>
      </ul>
    </div>
  </div>
  <div class="rrr">
    <div class="spaa">
      <%
						 
						 
						 
						 String likes="";
						String name="";
						 String date="";
						  Statement st21=MyDriver.getConnection("READ");
						 ResultSet rs21=st21.executeQuery("select field from hr where userid='"+userid+"'");
						while(rs21.next())
						  {
							  likes=rs21.getString("field");
						  }
						StringTokenizer stringTokenizer = new StringTokenizer(likes,",");
							Statement st12=MyDriver.getConnection("READ");
							while(stringTokenizer.hasMoreTokens()){
						 ResultSet rs12=st12.executeQuery("select * from postmrp where mrp='rp' and ptech like '%"+stringTokenizer.nextToken()+"%'");
						while(rs12.next())
						  {
						 name=rs12.getString("title");	
						 date=rs12.getString("postedon");
						  String uid=rs12.getString("userid");
			  
			  %>
      <table width="97%" cellpadding="4"  >
        <tr>
          <td align="left" valign="top">&nbsp;</td>
          <td height="83" align="left" valign="top">&nbsp;</td>
          <td align="left" valign="top">&nbsp;</td>
        </tr>
        <tr>
          <td height="63" align="left" valign="top">&nbsp;</td>
          <td align="left" valign="top"><strong>Article Posted By :</strong></td>
          <td align="left" valign="top"><div align="right">
            <div class="iiii">
           <%
				  String cuname="";
            Statement st=MyDriver.getConnection("READ");
            int uid1=Integer.parseInt(uid);
              ResultSet rs=null;
			   if(uid1<1000)
			   {            
						 rs=st.executeQuery("select uname from user where userid='"+uid+"'");						
			   }
			   else if(uid1>1000&&uid1<10000)
			   {
				  rs=st.executeQuery("select uname from faculty where userid='"+uid+"'");
						
			   }
			   else
			   {
				   rs=st.executeQuery("select uname from hr where userid='"+uid+"'");
			   }
						while(rs.next())
						  {
							cuname=rs.getString("uname");%>
              <div align="left"><%=rs.getString("uname")%> - [<%=((rs12.getInt("userid")<1000)?"USER":(rs12.getInt("userid")>1000 && rs12.getInt("userid")<10000)?"FACULTY":(rs12.getInt("userid")>10000)?"HR":"")%>]</div><%}
			   %>
            </div>
            <div class="iiiii"><strong>Posted On :</strong><%=date%></div>
          </div></td>
        </tr>
        <tr>
          <td align="left" valign="top">&nbsp;</td>
          <td height="79" align="left" valign="top"><div class="dataartcile">
            <p><strong><%=name%></strong></p>
          </div></td>
          <td align="left" valign="top"><div class="dataartcile">
            <p><strong>File : <%=rs12.getString("file")%></strong>&nbsp;&nbsp;&nbsp;&nbsp;<a href="download.jsp?filename=<%=rs12.getString("file")%>"><font color="green" size="3"><strong>Download</strong></font></a></p>
          </div></td>
        </tr>
        <tr>
          <td align="left" valign="top">&nbsp;</td>
          <td height="81" align="left" valign="top" colspan="2"><table width="460" border="0">
            <tr>
			<% if(uname.equals(cuname))
							  { }
						else
							  {%>
              <td><a href="like.jsp?id=<%=rs12.getInt(1)%>&tn=postmrp&tid=mrpid&value=like1&fn=res.jsp"><img src="images/like.png" alt="like" /></a></td>
              <td><a href="like.jsp?id=<%=rs12.getInt(1)%>&tn=postmrp&value=unlike&amp;tid=mrpid&fn=res.jsp"><img src="images/unlike.png".png" alt="like" /></a></td>
			   <%}%>
              <td><img src="images/likeb.png" alt="like" width="24" height="21" /><strong> <%=rs12.getString("like1")%></strong></td>
              <td><img src="images/dis.png".jpg" alt="like" width="24" height="21" /><strong> <%=rs12.getString("unlike")%></strong></td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
          </table></td>
        </tr>
      </table>
      <%}
							}%>
    </div>
  </div>
</div>

</div>
</div>   
<!-- content ends -->
<!-- footer begins -->
<div id="footer">
  <p>Copyright  2011. Designed by <a href="#" title="Flash Templates">Knowledge Based Community Sharing System</a></p>
		<p><a href="#">Privacy Policy</a> | <a href="#">Terms of Use</a> </div>
<!-- footer ends -->

</div>
</div>
</body>
</html>
